package countLatch;

import java.util.concurrent.CountDownLatch;
public class CountDownLatch2 {
    public static void main(String[] args) throws InterruptedException {
        //加法计数器
        CountDownLatch c = new CountDownLatch(6);
        for (int i = 0; i < 6; i++) {
            new Thread(()->{
                System.out.println(Thread.currentThread().getName()+"->go out!");
                c.countDown();
            },String.valueOf(i)).start();
        }
        c.await();
        System.out.println("close door");
    }
}
